<template>
  <div class="ww10">
    <ul>
      <li>团队组织{{msg}}</li>
      <li @click="changeNum">
        <el-button>子传父按钮</el-button>
      </li>
    </ul>
    <hr />
    <p>
      子: {{ numSun }}
      <el-button @click="changeBrother">子组件之间传值按钮</el-button>
    </p>
  </div>
</template>
<script lang="ts" setup>
import emitter from '../plugins/Bus' // 子组件相互传值
let strLeftNavValue = $ref('这个是leftNav的数据')
let num = $ref(100);
const emit = defineEmits(['fn', 'update:numSun'])
// const emit = defineEmits<{
//   (e: 'fn', id: number): void
// }>()
const changeBrother = ()=>{ // 子组件相互传值
  emitter.emit('fn', strLeftNavValue)
}
const changeNum = () =>{
  emit('fn', num)
}
const props = defineProps({
  msg: {
    type: String, // 类型
    default: '11' // 默认值，如果父组件没有传值，就默认这个值
  },
  numSun: {
    type: Number,
    default: 1
  }
})

const sunChangeFather = ()=>{
  emit('update:numSun', 200)
}

</script>
<style scoped lang="scss">

</style>